package com.develop.BeanUtils;

import java.util.concurrent.ConcurrentLinkedQueue;

import io.netty.channel.ChannelId;

public class SharedStorage {
	private static ConcurrentLinkedQueue<ChannelBean> channelList = new ConcurrentLinkedQueue<>();

	public static ConcurrentLinkedQueue<ChannelBean> getChannelList() {
		return channelList;
	}

	public static ChannelBean getChannelBean(ChannelId channelId) {
		for (ChannelBean bean : channelList) {
			if (bean.getChannelId().equals(channelId)) {
				return bean;
			}
		}
		return null;
	}

	public static ChannelBean getChannelBean(String cityCode, String firmCode) {
		for (ChannelBean bean : channelList) {
			if (bean.getCityCode().equals(cityCode) && bean.getFirmCode().equals(firmCode)) {
				return bean;
			}
		}
		return null;
	}
}
